<template>
	<!-- 鉴定 -->
	<view class="page">
		<view class="main">
			<view class="title">鉴定结果</view>
			<view class="radio-group">
				<view class="radio" v-for="(v,i) in radioList" :key="i" @click="form.authenticationResult=v.value">
					<image v-if="form.authenticationResult==v.value" class="radio_icon" src="/static/common/radio-a.png"
						mode="" />
					<image v-else class="radio_icon" src="/static/common/radio.png" mode="" />
					{{v.label}}
				</view>
			</view>
			<view class="title">鉴定原因说明</view>
			<view class="cause">
				<u--textarea v-model="form.authenticationReasons" placeholder="请输入鉴定原因说明" height="240rpx"></u--textarea>
			</view>
		</view>
		<view class="btn-box">
			<button class="btn" @click="identify">确定</button>
		</view>
	</view>
</template>

<script>
	export default {
		name: "authenticate",
		data() {
			return {
				radioList: [{
					label: '鉴定为真',
					value: '0'
				}, {
					label: '鉴定为假',
					value: '1'
				}, {
					label: '无法判断',
					value: '2'
				}, {
					label: '待补图',
					value: '3'
				}],
				form: {
					id: null,
					authenticationResult: null,
					authenticationReasons: null,

				}
			};
		},
		onLoad(data) {
			this.form.id = data.param
		},
		onShow() {},
		methods: {
			identify() {
				this.$api.identify(this.form).then(res => {
					console.log(res.data, "鉴定结果")
					if (res.data) {
						uni.$u.toast('鉴定成功');

						setTimeout(() => {
							uni.reLaunch({
								url: '/pages/appraiser/pages/workTable'
							})
						}, 2000)

					} else {
						uni.$u.toast('鉴定失败');
					}
				})
			}
		}
	};
</script>

<style lang="scss" scoped>
	.main {
		padding: 32rpx;
		box-sizing: border-box;

		.title {
			font-weight: bold;
			font-size: 32rpx;
			color: #1A1A1A;
		}

		.radio-group {
			width: 500rpx;
			display: grid;
			grid-template-columns: repeat(2, 1fr);
			margin-bottom: 48rpx;

			.radio {
				display: flex;
				align-items: center;
				gap: 16rpx;
				margin-top: 24rpx;
				font-size: 28rpx;
				color: #333333;

				.radio_icon {
					width: 28rpx;
					height: 28rpx;
				}

			}
		}

		.cause {
			margin-top: 16rpx;
		}
	}
</style>